正文
今天继续折腾Emacs的相关设置
主要进行了一下更新
- 将
c++-mode
的代码缩进设为由\t
填充(defun my-cpp-mode-common-hook () (setq c-basic-offset 4) (setq default-tab-width 4) (setq indent-tabs-mode t) ) (add-hook 'c-mode-common-hook 'my-cpp-mode-common-hook)- 将’F9’绑定为编译,并将其功能设定为与
Dev-cpp
完全一样
ps:其中的编译命令请按需修改(defun defineCompileCmd() (interactive) (setq compile_file_name (substring (buffer-name (current-buffer)) 0 (string-match "[.]" (buffer-name (current-buffer))))) (setq compile-command (concat "g++ -o " compile_file_name " " compile_file_name ".cpp -lm -O2 -Wl,-stack=100000000" )) ;;g++ -o watchdog watchdog.cpp -lm -O2 -Wl,-stack=100000000 -static -static -static -static ) (defun shrink-compile-window() "shrink compile window, avoid compile window occupy 1/2 hight of whole window" (interactive) ;;(select-window (get-buffer-window "*compilation*")) (setq compiled_buffer_name (buffer-name (current-buffer))) (switch-to-buffer-other-window "*compilation*") (if (< (/ (frame-height) 3) (window-height)) (shrink-window (/ (window-height) 2))) (switch-to-buffer-other-window compiled_buffer_name) ) (global-set-key [f9] '(lambda() "Save buffers and start compile" (interactive) (save-some-buffers t) (defineCompileCmd) (compile compile-command) (shrink-compile-window) ) )- 安装了一堆挺好用的插件以及进一步设置了Emacs
整个init.el
在这里:http://paste.ubuntu.com/23881203/
大家按需配置吧!